home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Oct, 2000
- // Author: bb
- //
- // Procedure Name:
- // cacheClipData
- //
- // Description:
- // Callback used before removing attributes from a character
- // to cache clip data for the attributes. The
- // clip data is isolated separate from the character in a
- // clipLibrary from which it can be copied and pasted
- // onto a new character using copyCachedClipDataCallback.
- //
- // Input Arguments:
- // $character : name of the original character
- // $attrs : attributes to be cached
- //
- // Return Value:
- // Library file and clip names for the cached clips
- //
- global proc string[]
- cacheClipDataForCharacter(string $character, string $attrs[])
- {
- // Isolate any clips for channels that we want to copy to the other
- // new subcharacter
- //
- string $isolateResult[];
- if (size($attrs) > 0) {
- string $sch = `character -q -sc $character`;
- if (size($sch) > 0) {
- string $schedClips[] = `clipSchedule -q -n $sch`;
- if (size($schedClips) > 0) {
- string $isolateCmd = "clip -ignoreSubcharacters -isolate";
- for ($sc in $schedClips) {
- $isolateCmd += (" -name "+$sc);
- }
- for ($aic in $attrs) {
- $isolateCmd += (" -uc "+$aic);
- }
- $isolateCmd += (" "+$character);
- $isolateResult = eval($isolateCmd);
- }
- }
- }
- return $isolateResult;
- }
-
- global proc string[]
- cacheClipData(string $character, string $attrs[])
- {
- string $result[];
-
- // If the character isn't specified, find out if the attributes are in
- // a character
- //
- if ("" == $character) {
- int $ii, $jj;
- int $atCount = size($attrs);
- string $myAttrs[];
- string $myChars[];
- for ($ii = 0; $ii < $atCount; $ii++) {
- string $mem[] = `listConnections -d 1 -s 0 -type character $attrs[$ii]`;
- if (size($mem)) {
- $myAttrs[$ii] = $attrs[$ii];
- $myChars[$ii] = $mem[0];
- } else {
- $myAttrs[$ii] = "";
- $myChars[$ii] = "";
- }
- }
- for ($ii = 0; $ii < $atCount; $ii++) {
- string $attrsToAdd[];
- if ($myAttrs[$ii] == "") continue;
-
- $attrsToAdd[0] = $myAttrs[$ii];
- string $currChar = $myChars[$ii];
- for ($jj = 0; $jj < $atCount; $jj++) {
- if ($myChars[$jj] == $currChar) {
- $attrsToAdd[size($attrsToAdd)] = $myAttrs[$jj];
- $myAttrs[$jj] = "";
- $myChars[$jj] = "";
- }
- }
- string $currR;
- string $currResult[];
- $currResult = cacheClipDataForCharacter($currChar,$attrsToAdd);
- for ($currR in $currResult) {
- $result[size($result)] = $currR;
- }
- clear($attrsToAdd);
- }
- } else {
- $result = cacheClipDataForCharacter($character,$attrs);
- }
- return $result;
- }
-